﻿<template>
    <div class="detail-con user-list ft14">
        
    
        <div class="detail-item">
            <span class="item-tit">是否开启上报功能</span>
            <div style="height:35px;padding-top:5px;">
                <label class="mr20" @click="ChangeSex('是')">
                    <div class="icheckbox_square-blue mr5"  v-bind:class="{ checked: iskq=='是' }" >
                        <span class="iconfont icon-check ft12"></span>
                    </div>是
                </label>
                <label @click="ChangeSex('否')">
                    <div class="icheckbox_square-blue mr5" v-bind:class="{ checked: iskq=='否' }">
                        <span class="iconfont icon-check ft12"></span>
                    </div>否
                </label>
            </div>
        </div>
      
      
        <div class="detail-item">
            <span class="item-tit">电话</span>
            <input type="text" class="settings-input form-control" placeholder="输入电话"  v-model="UserData.telphone">
        </div>
       
        
        <div class="detail-item">
            <span class="item-tit"></span>
            <button class="btn btn-info pl20 pr20" @click="SaveData()"><i class="fa fa-spinner fa-spin" style="display: none"></i>保存</button>
        </div>

    </div>
</template>

<script>
    module.exports = {
        name:'xtgl_index',
        props: ['pdata'],
        data: function () {
            return {
                name: "管理站设置",
                iswf: true,//是否属于流程表单
                iskq: "是",
                RoleData: [],
                DeptName: "",
                userName: "",
                seltype: 1,
                UserData: {}
            }
        },
        methods: {
            ChangeSex: function (type) {
                this.UserData.Sex = type;
            },
            InitWigetData: function () {
                var pro = this;
                //人员信息
                $.getJSON('/api/Auth/ExeAction?Action=GETUSERBYUSERNAME', { "P1": ComFunJS.getnowuser() }, function (resultData) {
                    if (resultData.ErrorMsg == "") {
                        pro.UserData = resultData.Result.User;
                        pro.DeptName = resultData.Result.BranchInfo.DeptName;
                        pro.UserData.UserOrder = !pro.UserData.UserOrder ? 0 : pro.UserData.UserOrder;
                    }
                })
            },
            SaveData: function (dom) {
                var tempindex = this;
                if (!(/^0?1[3|4|5|8|7][0-9]\d{8}$/.test(tempindex.UserData.mobphone))) {
                    top.ComFunJS.winwarning("手机号填写不正确");
                    return;
                }
                $(dom).attr("disabled", true).find(".fa").show();//加上转圈样式
                var modelValue = JSON.stringify(tempindex.UserData);
                $.getJSON("/api/Auth/ExeAction?Action=ADDUSER", { P1: modelValue, P2: "" }, function (result) {
                    $(dom).attr("disabled", false).find(".fa").hide();//加上转圈样式
                    if (result.ErrorMsg == "") {
                        top.ComFunJS.winsuccess("修改用户信息成功");
                    }
                });
            }
        },
        mounted: function () {
            var pro = this;
            pro.$nextTick(function () {
                pro.InitWigetData();
            })

        }
    };
</script>